package C7_4_InineClass;

import C7_3_ExtractClass.TelephoneNumber;
import org.junit.Test;

/**
 * 重构后
 */
public class Person2 {

    private String _name;
    private String _officeAreaCode;
    private String _officeNumber;

    public String getName(){
        return _name;
    }

    public String getTelePhoneNumber(){
        return ("(" + _officeAreaCode + ") " + _officeNumber);
    }

    String getOfficeAreaCode(){
        return _officeAreaCode;
    }

    void setOfficeAreaCode(String arg){
        _officeAreaCode = arg;
    }

    String getOfficeNumber(){
        return _officeNumber;
    }

    void setOfficeNumber(String arg){
        _officeNumber = arg;
    }

    @Test
    public void test(){
        //重构前
        Person martin = new Person();
        martin.getOfficeTelephone().setAreaCode("781");
        //重构后
        Person2 martin2 = new Person2();
        martin2.setOfficeAreaCode("781");
    }

}
